import Vue from 'vue'
import Router from 'vue-router'

import  Home from '@/views/home/home'
import  News from '@/views/news/news'


import  Books from '@/views/books/books'

import  RedBooks  from '../views/books/redbooks'

import  SmallBooks  from '../views/books/smallbooks'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
     
      redirect:'/home'
    },
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    {
      path: '/news',
      name: 'news',
      component: News
    },
    {
      path: '/books',
      name: 'books',
      component: Books,
      // 路由嵌套子路由
      children:[
        // /books/redbooks
        {path: '/books/redbooks',name: 'books',component: RedBooks},
        {path: 'smallbooks',name: 'books',component: SmallBooks},
        {path: '',name: 'books',component: RedBooks}
        // {path: 'smallbooks'  相当于/books/smallbooks
      ]
    }
  ]
})
